package com.woniuxy.amusementparkos.service.lsy.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.woniuxy.amusementparkos.dao.wyh.WristStrap_InfoDao;
import com.woniuxy.amusementparkos.entity.lsy.WriststarpInfoCondition;
import com.woniuxy.amusementparkos.entity.wyh.WristStrap_Info;
import com.woniuxy.amusementparkos.service.lsy.WriststrpInfoBackUpService;

/**
* @author Muzi
* 后台腕带信息管理实现服务类
* 2020年5月4日下午6:47:56
*/
@Service
public class WriststrpInfoBackUpServiceImpl implements WriststrpInfoBackUpService {

	@Autowired
	WristStrap_InfoDao wristStrap_InfoDao;
	
	@Override
	public List<WristStrap_Info> getAllByConditionAndPage(WriststarpInfoCondition condition, Integer page, Integer limit) {
		// 计算起始条数
		Integer start = (page-1)*limit;
		return wristStrap_InfoDao.listAllByConditions(condition, start, limit);
	}

	@Override
	public Long countAllByConditions(WriststarpInfoCondition condition) {
		// 通过条件查询符合条件的所有信息量
		return wristStrap_InfoDao.countAllByConditions(condition);
	}

	@Override
	public void updateWristStrapInfo(WristStrap_Info wristStrapInfo) throws RuntimeException {
		// 更新某条腕带租赁信息
		wristStrap_InfoDao.updateWristStrapInfo(wristStrapInfo);
	}

	@Override
	public void deleteWriststrpInfo(Integer info_id) {
		// 软删除单条腕带信息
		wristStrap_InfoDao.deleteWristStrapInfo(info_id);
	}

	@Transactional// 启用事务
	@Override
	public void deleteWriststrpInfoList(Integer[] id) {
		for (Integer info_id : id) {
			// 遍历软删除腕带信息
			wristStrap_InfoDao.deleteWristStrapInfo(info_id);
		}
		
	}

}
